﻿#region Using Statements
using System;
using Microsoft.Xna.Framework;
#endregion

namespace DirectZZT.Shared.Screens
{
    /// <summary>
    /// Defines mechanisms for a game screen.
    /// </summary>
    public interface IScreen : IDisposable
    {
        /// <summary>
        /// Gets the result of the screen (for the screen manager).
        /// This one is evaluated each cycle and determines whether the screen stays or leaves.
        /// </summary>
        /// <remarks>Setting only allowed by derived classes.</remarks>
        ScreenResult ScreenResult { get; }
        /// <summary>
        /// Gets/sets the opacity level of this screen.
        /// 1.0f is opaque (non-transparent) and 0.0f is transparent. The default value is 1.0f.
        /// </summary>
        float Opacity { get; set; }
        /// <summary>
        /// Gets/sets whether or not this screen is currently active.
        /// </summary>
        bool IsActive { get; set; }
        /// <summary>
        /// Gets/sets whether or not this <see cref="IScreen"/>-instance requires calls to
        /// <see cref="Update(double)"/> and <see cref="Draw()"/> even if it isn't active.
        /// See documentation for further information.
        /// </summary>
        /// <remarks>This should be set to <c>false</c> if possible, to minimize performance impact.</remarks>
        bool ForceProcessingWhileInactive { get; set; }

        /// <summary>
        /// Called when this screen is attached to a <see cref="IScreenManager"/>.
        /// </summary>
        /// <param name="screenManager"></param>
        void OnAttach(IScreenManager screenManager);
        /// <summary>
        /// Called when this screen is entered.
        /// </summary>
        void OnEnter();
        /// <summary>
        /// Called when this screen is left.
        /// </summary>
        void OnLeave();

        /// <summary>
        /// Updates this screen.
        /// </summary>
        /// <param name="gameTime"></param>
        void Update(GameTime gameTime);
        /// <summary>
        /// Draws this screen.
        /// </summary>
        /// <param name="gameTime"></param>
        void Draw(GameTime gameTime);
    }
}
